function windowScreen(){
    var h = document.documentElement.clientHeight || document.body.clientHeight || 0,
        w = document.documentElement.clientWidth || document.body.clientWidth || 0,
        box = {};
    box.h = h;
    box.w = w;
    return box;
}
!(function($){
  $(document).ready(function () {
    var agent = navigator.userAgent,
        isOpera=agent.indexOf("Opera") > -1,
        isSafair=(checkBrowser().name == "safari");
    console.log(checkBrowser().name)
    if(/.*Firefox.*/.test(agent)||(agent.indexOf("compatible") > -1 && agent.indexOf("MSIE") > -1 && !isOpera)){
         $("body").addClass("ffandie");
    }
    //头部置顶
    if (!isSafair){
      $(window).scroll(function() {
          if (/.*Firefox.*/.test(agent)) {
              document.addEventListener("DOMMouseScroll", function(e) {
                  e = e || window.event;
                  var detail = e.detail;
                  if (detail > 0) {//火狐标准正好相反
                      $(".header").hide();
                  } else {
                      $(".header").show();
                  }
              });
          } else{
              document.onmousewheel = function(e) {
                  e = e || window.event;
                  var wheelDelta = e.wheelDelta;
                  if (wheelDelta > 0) {//向上
                      $(".header").fadeIn();
                      //console.log("up")
                  } else {//向下
                      $(".header").fadeOut();
                      //console.log("down")
                  }
              }
          }
          if($(window).scrollTop() > 0){
              $(".header").addClass('scroll_header');
          } else {
              $(".header").removeClass('scroll_header');
          }
      });
    } else {
      $(".header").css({"position":"fixed"})
    }
    $(window).scroll(function(){
        var box = windowScreen();
        if ($(window).scrollTop() >= 200) {
            $('.getTop').css({"display":"block"});
        } else {
            $('.getTop').css({"display":"none"});
        };
    })

    $("header .menu>ul>li").hover(function () {
        $(this).children("ul").fadeIn();
        $(this).children("a").addClass("active");
    },function () {
        $(this).children("ul").hide();
        $(this).children("a").removeClass("active");
    });
    $("header .menu>ul>li>ul").mouseover(function () {
        $(this).children("ul").fadeIn();
    });
    $("header .menu>ul>li>ul").mouseover(function () {
        $(this).children("ul").hide();
    });
    $("header .menu>ul").mouseover(function () {
        $(this).addClass('active')
    });
    $("header .menu>ul").mouseout(function () {
        $(this).removeClass("active");
    });
    // $("header .menu>ul>li>ul>li").hover(function () {
    //     $(this).addClass("active");
    //     $(this).animate({paddingLeft:"30px"})
    // },function () {
    //     $(this).removeClass("active");
    //     $(this).animate({paddingLeft:"20px"})
    // })

    $(".lan_list").hover(function () {
        $("#en").show();
    },function () {
        $("#en").hide();
    });

    $('.getTop').click(function() {
        $('html,body').animate({scrollTop: '0px'},800);
        $(".header").fadeIn();
    });

    $(".qrcode").click(function(){
        $(".erweima").show()
        $("body").css({overflow:"hidden"});
    })
    $(".qr_close").click(function(){
        $(".erweima").hide()
        $("body").css({overflow:"auto"});
    })
     //if (!isSafair){
    onScroll(function(direction) {
      if(direction=="down"){
          $(".header").fadeOut();
      }else{
          $(".header").fadeIn();
      }
       
  });
    function onScroll( fn ) {
        var beforeScrollTop = document.body.scrollTop,
            fn = fn || function() {};
            if(document.addEventListener){
              window.addEventListener("scroll", function() {
                  var afterScrollTop = document.body.scrollTop,
                      delta = afterScrollTop - beforeScrollTop;
                  if( delta === 0 ) return false;
                  if(afterScrollTop <=0){
                    fn("up")
                    return
                  }
                  // console.log($(document).height())
                  // console.log(afterScrollTop)
                  
                  if($(document).scrollTop() + $(window).height() == $(document).height()){
                    fn("down")
                    return
                  }
                  fn( delta > 0 ? "down" : "up" );
                  beforeScrollTop = afterScrollTop;
              }, false);
            }
    }
//}
  })
})(jQuery);

function openPre(t,id){//棰勫畾浜у搧锛欰llone鏅鸿兘閬ユ帶鍣�
      var box = windowScreen();
      if(checkBrowser() == "mobile"){
        var ml = ml = (box.w - 320) / 2;
      }else{
        var  ml = (box.w - 450) / 2;
      }
      var bgTop = document.documentElement.scrollTop || document.body.scrollTop || 0,
          preTop = bgTop + 60,
          sw = document.documentElement.offsetWidth || document.body.offsetWidth || 0,
          sbw = sw - box.w;
      $('.pre_window').show().css({
        top:''+preTop+'px',
        left:''+ml+'px'
      });
      $('.media_bg').show().css({
        top:''+bgTop+'px',
        width:''+sw+'px',
        height:''+box.h+'px'
      })
      $('.prew_top').find('div').text("棰勫畾浜у搧锛�" + t);
      $('.prew_top').find('input').val(id);
      $('body').addClass('modal-open').css("padding-right",''+sbw+'px');
      

    }

    function closePreWindow(){
      $('.pre_window').hide();
      $('.media_bg').hide();
      $('.oc_window').hide();
      $('body').removeClass('modal-open').attr('style','');
    }
// 娴忚鍣ㄥ垽鏂�
function checkBrowser(){
var u = window.navigator.userAgent.toLocaleLowerCase(),
    msie = /(msie) ([\d.]+)/,
    chrome = /(chrome)\/([\d.]+)/,
    firefox = /(firefox)\/([\d.]+)/,
    safari = /(safari)\/([\d.]+)/,
    opera = /(opera)\/([\d.]+)/,
    ie11 = /(trident)\/([\d.]+)/,
    b = u.match(msie)||u.match(chrome)||u.match(firefox)||u.match(safari)||u.match(opera)||u.match(ie11),
    m = u.indexOf('mobile');
if(m > 0){
  return "mobile";
}else{
  return {name: b[1], version: parseInt(b[2])};
};
};

function windowScreen(){
var h = document.documentElement.clientHeight || document.body.clientHeight || 0,
    w = document.documentElement.clientWidth || document.body.clientWidth || 0,
    box = {};
    box.h = h;
    box.w = w;
return box;
}

// 杞崲鍥剧粍浠�
!function($){
$.fn.slider=function(settings,t){
  if(!this.length){
    return false;
  };
  settings=$.extend({},$.slider.defaults,settings);
  var obj=this;
  var scroller={};
  scroller.fn={};
  scroller.li = obj.find('li');
  var box = windowScreen();

  scroller.sliderName = $('.'+settings.sliderName+'');
  scroller.onNum = 0;
  scroller.auto = settings.auto;
  scroller.itemSum = scroller.li.length;
  for(var u = 0 ; u < scroller.itemSum; u++ ){
    scroller.li.eq(u).css('width','100%');
    //scroller.li.eq(u).find('div').css('width',''+box.w+'px');
  }
  scroller.bLeftBtn = obj.parent('div').find('a.bLeft');
  scroller.bRightBtn = obj.parent('div').find('a.bRight');
  scroller.bLeftBtnPer = settings.bLeft;
  scroller.bRightBtnPer = settings.bRight;
  scroller.moveSlider = settings.moveSlider;
  scroller.times = settings.time;
  scroller.opacity = settings.opacity;
  scroller.colorCout = 0;
  
  // 鏂规硶锛氬紑濮�
  scroller.fn.on=function(){

    scroller.fn.off();
    scroller.fn.removeControl();
    scroller.fn.addControl();

    if(!scroller.auto){return;};
    scroller.run=setTimeout(function(){
      scroller.fn.goto(settings.direction);
    },scroller.times);
  };
  // 鏂规硶锛氬仠姝�
  scroller.fn.off=function(){
    if(typeof(scroller.run)!=="undefined"){clearTimeout(scroller.run);};
  };
  // 鏂规硶锛氬鍔犳帶鍒�
  scroller.fn.addControl=function(){
    if(scroller.bLeftBtnPer&&scroller.bLeftBtn.length){
      scroller.bLeftBtn.bind("click",function(){
        scroller.fn.goto("bLeft");
      });
    };
    if(scroller.bRightBtnPer&&scroller.bRightBtn.length){
      scroller.bRightBtn.bind("click",function(){
        scroller.fn.goto("bRight");
      });
    };
  };
  // 鏂规硶锛氳В闄ゆ帶鍒�
  scroller.fn.removeControl=function(){
    if(scroller.bLeftBtn.length){scroller.bLeftBtn.unbind("click");};
    if(scroller.bRightBtn.length){scroller.bRightBtn.unbind("click");};
  };

  //鏈夎疆鎾爣璁�
  if(settings.markSlider && !scroller.moveSlider) {

    scroller.markLi  =obj.siblings('.'+settings.markClass+'').find('li');
    // 鏂规硶锛氱偣鍑昏疆鎾爣璁板垏鎹�
    scroller.markLi.on(settings.control,function(){
      scroller.fn.off();
      scroller.markNum = scroller.markLi.index($(this));
      scroller.rotateEffectNum = $('.bvclb_title > p > em').index($('.rotateEffect'));
      if(scroller.markNum == scroller.rotateEffectNum){
        return false;
      }
      scroller.li.addClass(''+settings.play+'').stop(1,1).css({
        opacity:"1",
        filter:"alpha(opacity=100)",
        display:"none"
      });
      scroller.li.eq(scroller.markNum-1).stop(1,1).css("opacity",'0.5').addClass(''+settings.play+'').css("display",'block').animate({opacity:"0"},settings.speed,function(){
        $(this).css('display','none');
      }); 
      scroller.li.eq(scroller.markNum).stop(1,1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed);
      if(settings.phonebg && settings.ln){//鎵嬫満杞崲
        scroller.phonebg = $('.bvc_right').find('li');
        scroller.phonebg.addClass(''+settings.play+'').stop(1,1).css({
          opacity:"1",
          filter:"alpha(opacity=100)",
          display:"none"
        });
      
        scroller.phonebg.eq(scroller.markNum).stop(1,1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed);
      }else if(settings.phonebg && !settings.ln){
        scroller.phonebg = $('.phone_bg');
        scroller.phonebg.addClass(''+settings.play+'').stop(1,1).css({
          opacity:"1",
          filter:"alpha(opacity=100)",
          display:"none"
        },settings.speed);
        scroller.phonebg.eq(scroller.markNum).stop(1,1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed);
      }
      if(settings.specialText){//鏂囧瓧杞崲
        scroller.specialText = $('.bvclb_title > p > em');
        scroller.specialText.addClass(''+settings.play+'').removeClass('rotateEffect').stop(1,1).css({
          opacity:"1",
          filter:"alpha(opacity=100)"
        });
        scroller.specialText.eq(scroller.rotateEffectNum).addClass('upEffect').siblings().removeClass('upEffect');
        scroller.specialText.eq(scroller.markNum).stop(1,1).css('opacity','0.1').removeClass(''+settings.play+'').addClass('rotateEffect').css("display",'inline-block').animate({
          opacity:"1"
        },settings.speed);

      }
      scroller.markLi.removeClass(''+settings.markLiClass+'');
      $(this).addClass(''+settings.markLiClass+'');
      scroller.fn.on();
    });    
  }else if(settings.markSlider && scroller.moveSlider){
    scroller.markLi  =obj.siblings('.'+settings.markClass+'').find('li');
    scroller.markLi.on(settings.markEvent,function() {
      scroller.markNum = scroller.markLi.index($(this));
      scroller.li.removeClass(''+settings.play+'');
      scroller.li.eq(scroller.markNum+1).addClass(''+settings.play+'');
      scroller.markLi.removeClass(''+settings.markLiClass+'');
      obj.animate({
          left:'-'+(scroller.markNum+1)*scroller.li.width()+'px'
      });
      $(this).addClass(''+settings.markLiClass+'');  
    });   
    
  
  };
  if(settings.hoverStop){
    scroller.li.hover(function(){
      scroller.fn.off();
    },function(){
      scroller.fn.on();
      scroller.colorCout == 1;
    });
  }
  // 鏂规硶锛氭粴鍔�
  scroller.fn.goto=function(d){
    scroller.fn.off();
    if(settings.bLeft && settings.bRight){
      scroller.fn.removeControl();
    };
    
    obj.stop(true);
    if(!scroller.moveSlider){
      scroller.onCurNum = scroller.li.index(obj.find('li:not(.'+settings.play+')'))  ;//play 浣嶇疆
    }else{
      scroller.onCurNum = scroller.li.index(obj.find('li[class="'+settings.play+'"]'))  ;//play 浣嶇疆   
    };
   
    if(scroller.opacity && !scroller.moveSlider){
      scroller.li.eq(scroller.onCurNum).addClass(''+settings.play+'').stop(1, 1).animate({
        opacity:"0",
        filter:"alpha(opacity=0)"
      },settings.speed,function(){
        $(this).css({display:"none",opacity:"1"});
      });
   
    };
    if(settings.phonebg && settings.ln){
        scroller.phonebg = $('.bvc_right').find('li');
        scroller.phonebg.addClass(''+settings.play+'').stop(1, 1).animate({
          opacity:"0",
          filter:"alpha(opacity=0)"
        },0,function(){
            $(this).css({display:"none",opacity:"1"});
        });
       
    }else if(settings.phonebg && !settings.ln){
      scroller.phonebg = $('.phone_bg');
        scroller.phonebg.addClass(''+settings.play+'').stop(1, 1).animate({
          opacity:"0",
          filter:"alpha(opacity=0)"
        },0,function(){
            $(this).css({display:"none",opacity:"1"});
        });

    }
    switch(d){

      case "bRight":
      //婊戝姩
      if(scroller.moveSlider && (scroller.onCurNum+1) == scroller.itemSum){//5
        scroller.totalWidth = scroller.itemSum * scroller.li.width();
        obj.css('left','-'+scroller.li.width()+'px');
        obj.animate({left:'-'+2*scroller.li.width()+'px'});
        scroller.li.removeClass(''+settings.play+'');
        scroller.li.eq(2).addClass(''+settings.play+'');
        if(settings.markSlider){scroller.markLi.removeClass(''+settings.markLiClass+'').eq(1).addClass(''+settings.markLiClass+'');}

      }else if(scroller.moveSlider && scroller.onCurNum == 1){
        obj.animate({left:'-'+2*scroller.li.width()+'px'});
        scroller.li.removeClass(''+settings.play+'');
        scroller.li.eq(2).addClass(''+settings.play+'');
        if(settings.markSlider){scroller.markLi.removeClass(''+settings.markLiClass+'').eq(1).addClass(''+settings.markLiClass+'');}
      }else if(scroller.moveSlider && scroller.onCurNum != scroller.itemSum){//1-4
        obj.animate({
         left:'-'+(scroller.onCurNum+1)*scroller.li.width()+'px'
        });
        scroller.li.removeClass(''+settings.play+'');
        scroller.li.eq(scroller.onCurNum+1).addClass(''+settings.play+'');
        if(settings.markSlider) {
          if((scroller.onCurNum+2) == scroller.itemSum){
            scroller.markLi.removeClass(''+settings.markLiClass+'').eq(0).addClass(''+settings.markLiClass+'');
          }else{
            scroller.markLi.removeClass(''+settings.markLiClass+'').eq(scroller.onCurNum).addClass(''+settings.markLiClass+'');
          }
        }
      }
      //娓愰殣
      if(((scroller.onCurNum+1) == scroller.itemSum) && !scroller.moveSlider ){
        $('.'+settings.numClass+'').html("<em>1</em> / "  + scroller.itemSum);
        scroller.li.eq(0).stop(1, 1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed); 
        if(settings.markSlider){scroller.markLi.removeClass(''+settings.markLiClass+'').eq(0).addClass(''+settings.markLiClass+'');}
        if(settings.phonebg && settings.ln){
          scroller.phonebg = $('.bvc_right').find('li');
          scroller.phonebg.eq(0).stop(1, 1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed); 
        }else if(settings.phonebg && !settings.ln){
          scroller.phonebg = $('.phone_bg');
          scroller.phonebg.eq(0).stop(1, 1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed);
        }
        if(settings.specialText){//鏂囧瓧杞崲
          scroller.specialText = $('.bvclb_title > p > em');
          scroller.specialText.addClass(''+settings.play+'').removeClass('rotateEffect').stop(1,1).css({
            opacity:"1",
            filter:"alpha(opacity=100)"
          });
          scroller.specialText.eq(scroller.onCurNum).addClass('upEffect').siblings().removeClass('upEffect');
          scroller.specialText.eq(0).stop(1,1).css('opacity','0.1').removeClass(''+settings.play+'').addClass('rotateEffect').css("display",'inline-block').animate({
            opacity:"1"
          },settings.speed);

        }

      }else if(((scroller.onCurNum+1) != scroller.itemSum) && !scroller.moveSlider ){
        $('.'+settings.numClass+'').html("<em>"+( scroller.onCurNum + 2)+"</em> / "  + scroller.itemSum);
        scroller.li.eq(scroller.onCurNum+1).stop(1, 1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed);
   
        if(settings.markSlider){
          scroller.markLi.removeClass(''+settings.markLiClass+'').eq(scroller.onCurNum+1).addClass(''+settings.markLiClass+'');
        }  
        if(settings.phonebg && settings.ln){
          scroller.phonebg = $('.bvc_right').find('li');
          scroller.phonebg.eq(scroller.onCurNum+1).stop(1, 1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed);
        }else if(settings.phonebg && !settings.ln){
          scroller.phonebg = $('.phone_bg');
          scroller.phonebg.eq(scroller.onCurNum+1).stop(1, 1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed);
        }
        if(settings.specialText){//鏂囧瓧杞崲
          scroller.specialText = $('.bvclb_title > p > em');
          scroller.specialText.addClass(''+settings.play+'').removeClass('rotateEffect').stop(1,1).css({
            opacity:"1",
            filter:"alpha(opacity=100)"
          });
          scroller.specialText.eq(scroller.onCurNum).addClass('upEffect').siblings().removeClass('upEffect');
          scroller.specialText.eq(scroller.onCurNum + 1).stop(1,1).css('opacity','0.1').removeClass(''+settings.play+'').addClass('rotateEffect').css("display",'inline-block').animate({
            opacity:"1"
          },settings.speed);

        }
      };
      break;
      case "bLeft":
      //婊戝姩
      if(scroller.moveSlider && scroller.onCurNum == 0){//0
          scroller.totalWidth = scroller.itemSum * scroller.li.width();
          obj.css('left','-'+(scroller.itemSum-2)*scroller.li.width()+'px');
          obj.animate({left:'-'+(scroller.itemSum-3)*scroller.li.width()+'px'});
          scroller.li.removeClass(''+settings.play+'');
          scroller.li.eq(scroller.onCurNum-3).addClass(''+settings.play+'');
          if(settings.markSlider){scroller.markLi.removeClass(''+settings.markLiClass+'').eq(scroller.onCurNum-2).addClass(''+settings.markLiClass+'');};
          
      }else if(scroller.moveSlider && scroller.onCurNum == 1){
          obj.animate({left:'0px'});
          scroller.li.removeClass(''+settings.play+'');
          scroller.li.eq(0).addClass(''+settings.play+'');
          if(settings.markSlider){scroller.markLi.removeClass(''+settings.markLiClass+'').eq(scroller.onCurNum+2).addClass(''+settings.markLiClass+'');};
          
      }else if(scroller.moveSlider && scroller.onCurNum != scroller.itemSum){//1-4
          obj.animate({
           left:'-'+(scroller.onCurNum-1)*scroller.li.width()+'px'
          });
          scroller.li.removeClass(''+settings.play+'');
          scroller.li.eq(scroller.onCurNum-1).addClass(''+settings.play+'');
          if(settings.markSlider){scroller.markLi.removeClass(''+settings.markLiClass+'').eq(scroller.onCurNum-2).addClass(''+settings.markLiClass+'');}
          
      };
      //娓愰殣
      if(scroller.onCurNum == 0  && !scroller.moveSlider ){
          scroller.li.eq(scroller.itemSum-1).stop(1, 1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed,function(){
              $(this).css('display','block');
          });

          $('.'+settings.numClass+'').html("<em>"+scroller.itemSum+"</em> / "  + scroller.itemSum);

          if(settings.markSlider){scroller.markLi.removeClass(''+settings.markLiClass+'').eq(scroller.itemSum-1).addClass(''+settings.markLiClass+'');};

          

      }else if(scroller.onCurNum != 0  && !scroller.moveSlider ){
          scroller.li.eq(scroller.onCurNum-1).stop(1, 1).css('opacity','0.5').removeClass(''+settings.play+'').css("display",'block').animate({opacity:"1"},settings.speed);

          $('.'+settings.numClass+'').html("<em>"+( scroller.onCurNum )+"</em> / "  + scroller.itemSum);

          //sisi
          if(settings.markSlider){scroller.markLi.removeClass(''+settings.markLiClass+'').eq(scroller.onCurNum-1).addClass(''+settings.markLiClass+'');};
          //sisi
          
      }
      break;

    }
    obj.queue(function(){
      if(settings.bLeft && settings.bRight ){
        scroller.fn.removeControl();
        scroller.fn.addControl();
      };
      if(scroller.auto){
        scroller.run=setTimeout(function(){
          scroller.fn.goto(settings.direction);
        },scroller.times);
      };
     
      
      $(this).dequeue();
    });
  };
      
  scroller.fn.on();
};

// 榛樿鍊�
$.slider={defaults:{
    speed:800,      // 婊氬姩閫熷害
    time:4000,      // 鑷姩婊氬姩闂撮殧鏃堕棿
    play:"on",         //閫変腑鏍峰紡
    num:true,        //鏄惁鍑虹幇鎬绘暟
    numClass:"slider_num" ,    // 鎬绘暟鏄剧ず鍖哄煙
    auto:true,
    bLeft:true,                 //宸︽帶
    bRight:true ,            //鍙虫帶
    direction:"bRight",  // 椤哄簭
    addControl:false,
    control:"mouseenter",
    moveSlider:false,
    opacity:true, 
    hoverStop:true,
    markSlider:true,           //鏄惁鏈夎疆鎾爣璁�
    markClass:"slider_mark",       //杞挱缁撴瀯
    markLiClass:"mark_dot_on",        //杞挱褰撳墠鎬乧lass
    markEvent:"click"//鐐瑰嚮璺宠浆
}};
}(jQuery);

//鎾斁
function openVideo(address){
var box = windowScreen(),
    str = '',
    vw = box.w * 0.8,
    ml = box.w * 0.1,
    vh = box.h - 120,
    n = checkBrowser(),
    bgTop = document.documentElement.scrollTop || document.body.scrollTop || 0,
    videoTop = bgTop + 60,
    closeTop = bgTop + 10,
    sw = sw = document.documentElement.offsetWidth || document.body.offsetWidth || 0,
    sbw = sw - box.w;
str += '<div class="media_bg" onclick="javascript:closeVideo()" style="width:'+box.w+'px; height:'+box.h+'px; top:'+bgTop+'px"></div>';
str += '<a href="javascript:closeVideo()" class="video_close" style="top:'+closeTop+'px" ></a>';
str += '<div class="media_play" style="width:'+vw+'px; height:'+vh+'px; left:'+ml+'px; top:'+videoTop+'px">';
str += '<video width="'+vw+'" height="'+vh+'" controls autoplay>';
str += '<source src="'+address+'" type="video/mp4; codecs="avc1.42E01E, mp4a.40.2""></source>';
str += '</video></div>';
$('body').append(str);
$('body').addClass('modal-open').css("padding-right",''+sbw+'px');
if(n.name = 'msie' && n.version <9){
  $.getScript("js/html5media.min.js");
}
}
function popAd(imgSrc){
var box = windowScreen(),
    str = '',
    vw = box.w * 0.8,
    ml = box.w * 0.1,
    vh = box.h - 120,
    n = checkBrowser(),
    bgTop = document.documentElement.scrollTop || document.body.scrollTop || 0,
    videoTop = bgTop + 120,
    closeTop = bgTop + 10,
    sw = sw = document.documentElement.offsetWidth || document.body.offsetWidth || 0,
    sbw = sw - box.w;
str += '<div class="media_bg" onclick="javascript:closeVideo()" style="width:'+box.w+'px; height:'+box.h+'px; top:'+bgTop+'px"></div>';
str += '<div class="advertisement" style="width:'+vw+'px; left:'+ml+'px ; top:'+videoTop+'px">';
str += '<a href="http://blog.orvibo.com/enblog/?p=203" target="_blank">';
str += '<img src="'+imgSrc+'">';
str += '</a></div>';
$('body').append(str);
$('body').addClass('modal-open').css("padding-right",''+sbw+'px');

}
function popHad(imgSrc,url){
var str = '';
str += '<div class="h_ad">';
str += '<a href="'+url+'"></a>';
str += '<span>3绉掑悗鑷姩娑堝け</span>';
str += '<em></em>';
str += '</div>';
$('body').append(str);
}
var popTime = 3;
function reciprocal(){
popTime --;
if (popTime > 0){
  $('.h_ad > span').text(''+popTime+'绉掑悗鑷姩娑堝け');
}else if(popTime < 1){
  $('.h_ad').remove();
}
}
setInterval(function(){
//reciprocal();
},1000)

function closeVideo(){
$('.media_bg').remove();
$('.video_close').remove();
$('.media_play').remove();
$('.advertisement').remove();
$('body').removeClass('modal-open').attr('style','');
}

//box
//JavaScript Document
(function($){
$.fn.skyBox = function(options, callback){  
var defaults = {  
  title: "skybox",  
  content:"淇℃伅鍐呭",
  cancel: "Cancel",
  okay: "Okay",
  okaybutton: true,
  cancelbutton: true,
  opacity: 0,
  fadeout: true,
  overlayclose: true,
  modalwidth: "",
  autoClose:false,
  autoCloseTime:1000
};
var options = $.extend(defaults, options),
    domWidth=document.documentElement.clientWidth || document.body.clientWidth || 0 ,
    domHeight=document.documentElement.clientHeight || document.body.clientHeight || 0,
    scrollHeight=document.documentElement.scrollTop || document.body.scrollTop || 0,  
    str="",
boxWidth="";
options.modalwidth=="" ? boxWidth=="310px" :  boxWidth=options.modalwidth ; 
var left=(domWidth-boxWidth)/2;
str+='<div id="box" style="width:'+boxWidth+'px; left:'+left+'px">';
str+='<div class="title"><h2>'+options.title+'</h2></div>';
str+='<div class="content"><div class="text">'+options.content+'</div>';
if((options.okaybutton!=false && options.cancelbutton==false) || (options.okaybutton==false && options.cancelbutton!=false)){
  str+='<div class="input">';
  options.okaybutton==true ? str += '<input type="button" value="'+options.okay+'" class="confrimBox">' : str+='<input type="button" value="'+options.cancel+'" class="closeBox">';
  str+='</div>';
}else if(options.okaybutton==true && options.cancelbutton==true){
  str+='<div class="input">';
  str+='<input type="button" value="'+options.okay+'" class="confrimBox">' ;
  str+='<input type="button" value="'+options.cancel+'" class="closeBox">';
  str+="</div>";
};
str+='</div>';
str+='</div>';
options.fadeout==true ? str+='<div class="fadeLayerBox" style="opacity:"'+options.opacity+'";filter: alpha(opacity="'+options.opacity*10+'")"></div>' : str+='<div class="fadeLayerBox closeBoxTwo"></div>';

$('body').append(str); 
var top=(domHeight-$('#box').height())/2+scrollHeight;
$('#box').css('top',""+top+"px");
$('.closeBox').click(function(){
  $('#box').remove();
  $('.fadeLayerBox').remove();
  return 2;
});
if(options.overlayclose==true){
  $('.fadeLayerBox').click(function(){
  $('#box').remove();
  $('.fadeLayerBox').remove();
  return 2;
 });
};
if(options.autoClose){
  setTimeout(function(){
    $('#box').remove();
    $('.fadeLayerBox').remove();
    return 2;
  },options.autoCloseTime);
}
}
})(jQuery);
